package com.xt.yncu.login.action;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;

import com.xt.base.action.BaseAction;
import com.xt.yncu.login.service.LoginMobileService;

/**
 *  <br>
 * <br>
 * 手机端登录
 * <p>
 * <a href="LoginMobileAction.java.html"><i>查看源文件</i></a>
 * </p>
 * 
 * @author 杨洪波
 * @create-date:2011-11-3
 */
public class LoginMobileAction extends BaseAction{

	private static final long serialVersionUID = -7809528369724457853L;
	
	private LoginMobileService loginMobileService;

	public String login(Map<String,Object> map){
		
		return loginMobileService.login(map);
	}

	public void setLoginMobileService(LoginMobileService loginMobileService) {
		this.loginMobileService = loginMobileService;
	}

	public String checkMobileClientUpdate(Map<String,Object> map){
		String path = this.getClass().getResource("\\").getPath();
		System.out.println(path.substring(0,path.indexOf("WEB-INF")));
		File file = new File(path.substring(0,path.indexOf("WEB-INF"))+"phone\\phone.xml");
		try {
			 Document doc = new SAXReader().read(file);
			 return doc.asXML();
		} catch (DocumentException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static void main(String[] args){
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("type", "ophone");
		new LoginMobileAction().checkMobileClientUpdate(resultMap);
	}
}
